package com.guess.learn.java;

/**
 * @ClassName: MyThread
 * @Description: MyThread，模拟一个任务
 * @Author: tianranll <tianranll@126.com>
 * @Date: 2017/10/16 13:25
 */
public class MyThread implements Runnable {

    private String threadName;

    public MyThread(String threadName) {
        this.threadName = threadName;
    }

    @Override
    public void run() {
        System.out.println(threadName + "开始执行...");
        for (int i = 1; i <= 5; i++) {
            System.out.println(threadName + "正在执行"+i+"...");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println(threadName + "结束...");
    }
}
